<template>
    <view class="page-home-index page-activity-list">
		<u-sticky>
			<view class="search-sticky flex-between">
                <view class="flex-1">
				    <u-search placeholder="请输入关键字" :clearabled="true" v-model="searchForm.guildName" :show-action="false" @clear="getList('refresh')" @search="getList('refresh')"></u-search>
                </view>
                <view class="ml-2 city" @click="proxy.$util.gotoPage('/packageA/branch/changeRecords')">
                    <text class="ml-1">申请记录</text>
                    <u-icon name="arrow-right" size="24"></u-icon>
                </view>
			</view>
		</u-sticky>
        <u-cell-group>
            <u-cell-item v-for="(item,index) in longList.list" :title="item.guildName" value="选择" :arrow="false" @click="refChangeGuild.init(item)"></u-cell-item>
        </u-cell-group>
        <change-guild ref="refChangeGuild" />
    </view>
</template>
<script setup lang="ts">
import ChangeGuild from './components/changeGuild.vue';
import {onShow, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';
let refChangeGuild = ref();
import { useLonglist } from '@/static/fn/longList';
const initObj = {
	listApi:'/admin/guilds/getGuildsList',
    resKey: 'data',
}
let { searchForm, longList, getList} = useLonglist(initObj);
import { useAppStore } from '@/stores/app';
import { useOptionData } from '@/stores/optionData';
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const appStore = useAppStore();
const optionDataStore = useOptionData();

onPullDownRefresh(() => {
	getList('refresh');
	setTimeout( () => {
		uni.stopPullDownRefresh();
	}, 1000);
});
onReachBottom(() =>{
	getList();
});
onShow(() => {
	getList('refresh');
});

</script>